package com.huanong.mapper;

import com.huanong.pojo.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 管理员登录注册相关的mapper
 */
@Repository
public interface AdminMapper {


    /**
     * 测试
     * @return
     */
    @Select("select * from admin")
    List<Admin> queryAll();

    /**
     * 更具账号信息，查询
     */
    @Select("select * from admin where anaccount = #{account}")
    Admin queryAdminByAccount(@Param("account") String adminAccount);

    @Insert("insert into admin(anname, ansex, anage, anaccount, anpassword, antime) values('${anName}', '${anSex}', ${anAge}, '${anAccount}', '${anPassword}', '${anTimeStr}')")
    void register(Admin admin);
}
